var windos = {
	ajaxPost: function(url, data, callback) {
		$.ajax({
			url: url,
			method: 'POST',
			dataType: 'json',
			data: data, 
			success: callback
		});
	},
	formatDate: function(timestamp, type) {
		var res = timestamp;
		if (timestamp) {
			var datetime = new Date(timestamp * 1000);
			var year = datetime.getFullYear();
			var month = datetime.getMonth() > 8 ? (datetime.getMonth() + 1) : '0' + (datetime.getMonth() + 1);
			var day = datetime.getDate() > 9 ? datetime.getDate() : '0' + datetime.getDate();
			var hour = datetime.getHours() > 9 ? datetime.getHours() : '0' + datetime.getHours();
			var minute = datetime.getMinutes() > 9 ? datetime.getMinutes() : '0' + datetime.getMinutes();
			var second = datetime.getSeconds() > 9 ? datetime.getSeconds() : '0' + datetime.getSeconds();
			switch(type) {
				case 0:
					res = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
				break;
				case 1:
					res = year + '-' + month + '-' + day;
				break;
				case 2:
					res = hour + ':' + minute + ':' + second;
				break;
			}
		} else {
			res = '-';
		}
		return res;
	},
	formatText: function(str) {
		var res = str ? str : '-';
		return res;
	},
	formatMobile: function(mobile, type) {
		var res = mobile;
		if ( ! this.isEmpty(mobile)) {
			var mobileStr = typeof mobile === 'number' ? mobile.toString() : '';
			numbers = mobileStr.split('');
			if (type == 0) {
				spanBegin = '<span>';
				spanStyle ='<span style="margin-left: 0.5em">';
				spanEnd = '</span>';
				var tmp = [];
				for (var i = 0; i < numbers.length; i ++) {
					if (i == 3 || i == 7) {
						tmp.push(spanStyle + numbers[i] + spanEnd);
					} else {
						tmp.push(numbers[i]);
					}
				}
				res = tmp.join('');
			}
		} else {
			res = '';
		}
		return res;
	},
	isEmpty: function(str) {
		var res = false;
		if (str == '' || str == null || str == 'undefined' || typeof(str) === 'undefined') {
			res = true;
		}
		return res;
	}
};